package com.huawei.esdk.tp.device.smc.v100r003c10;

import java.util.Date;
import java.util.List;

import com.huawei.esdk.platform.common.SDKResult;
import com.huawei.esdk.platform.commu.itf.ICXFSOAPProtocolAdapter;
import com.huawei.esdk.platform.exception.ProtocolAdapterException;
import com.huawei.esdk.tp.device.smc.v100r003c00.SMC20V1R3C00ConferenceManagerCapabilityImpl;
import com.huawei.esdk.tp.device.smc.v100r003c10.convert.TPSMC20V1R3C10MCUMgrConvert;
import com.huawei.esdk.tp.domain.model.bean.MCUInfoList;
import com.huawei.esdk.tp.domain.model.bean.MCUResourceList;
import com.huawei.esdk.tp.domain.model.bean.QuerySites;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.QueryMcuFutureResource;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.QueryMcuFutureResourceResponse;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.QueryMcuInfo;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.QueryMcuInfoResponse;
import com.huawei.esdk.tp.southcommu.cxf.gen.v100r003c10.SmcExternal2Soap;

public class SMC20V1R3C10MCUManagerCapabilityImpl extends SMC20V1R3C00ConferenceManagerCapabilityImpl implements SMC20V1R3C10IMCUManagerCapability
{
    private TPSMC20V1R3C10MCUMgrConvert tpMCUMgrConvertService = new TPSMC20V1R3C10MCUMgrConvert();
    
    /** * @param cxfSoapProtocolAdapter */
    public SMC20V1R3C10MCUManagerCapabilityImpl(ICXFSOAPProtocolAdapter cxfSOAPProtocolAdapter)
    {
        super(cxfSOAPProtocolAdapter);
    }
    
    protected String getR3C10SouthItfName()
    {
        return SmcExternal2Soap.class.getName();
    }

    @Override
    public SDKResult<MCUInfoList> queryMCUInfoEx(QuerySites querySites)
    {
        SDKResult<MCUInfoList> result = new SDKResult<MCUInfoList>();
        QueryMcuInfoResponse response = null;
        
        // 调用接口前转换
        QueryMcuInfo resMsg = tpMCUMgrConvertService.queryMCUInfoModel2Soap(querySites);
        
        try
        {
            response =
                (QueryMcuInfoResponse)sendProtocolMessage(resMsg,
                    getR3C10SouthItfName(),
                    "queryMcuInfo");
        }
        catch (ProtocolAdapterException e)
        {
            result.setErrCode(e.getErrorCode());
            return result;
        }
        
        // 南向转换成领域
        result = tpMCUMgrConvertService.queryMCUInfoSoap2Model(response);
        
        return result;
    }

    @Override
    public SDKResult<MCUResourceList> queryMCUFutureResourceEx(Integer duration, Date beginTime, List<Integer> mcus)
    {
        SDKResult<MCUResourceList> result = new SDKResult<MCUResourceList>();
        QueryMcuFutureResourceResponse response= null;
        
        // 调用接口前转换
        QueryMcuFutureResource resMsg = tpMCUMgrConvertService.queryMCUFutureResourceModel2Soap(duration, beginTime, mcus);
       
        try
        {
            response =
                (QueryMcuFutureResourceResponse)sendProtocolMessage(resMsg,
                    getR3C10SouthItfName(),
                    "queryMcuFutureResource");
        }
        catch (ProtocolAdapterException e)
        {
            result.setErrCode(e.getErrorCode());
            return result;
        }
        
        // 南向转换成领域
        result = tpMCUMgrConvertService.queryMCUFutureResourceSoap2Model(response);
        
        return result;
    }
    
}
